package com.cashmama.market.api.infras.enums.order;

/**
 * @program: market-api
 * @description
 * @author: frank
 * @create: 2020-12-01 15:33
 **/
public enum OpenOrderStatusEnum {

    INIT(0, "INIT", "Reviewing", "Reviewing", "URL/orderdetail"),
    CREATE_SUCCESS(1, "CREATE SUCCESS", "Reviewing", "Reviewing", "URL/orderdetail"),
    AUDIT_WATTING(2, "AUDIT WATTING", "Reviewing", "Reviewing", "URL/orderdetail"),
    LOAN_WAITTING(3, "LOAN WAITTING", "Transferring", "Transferring to your bank card", "URL/orderdetail"),
    PAY_RETRY(4, "PAY RETRY", "Transfer Failed", "Loan failed, please bind another bank account.", "URL/info?type=bank&title=Bank Details"),
    REPAYMENT_WATTING(5, "REPAYMENT WATTING", "Waiting for repay >", "Waiting for repay", "URL/orderdetail"),
    OVERDUE(6, "OVERDUE", "Overdue >", "Overdue", "URL/orderdetail"),
    NORMAL_REPAYMENT(7, "NORMAL_REPAYMENT","Completed", "Completed", "URL/orderdetail"),                                // 正常还款
    EARLY_REPAYMENT(8, "EARLY_REPAYMENT","Completed", "Completed", "URL/orderdetail"),       // 提前还款
    OVERDUE_REPAYMENT(9, "OVERDUE_REPAYMENT","Completed", "Completed", "URL/orderdetail"),                    // 逾期还款
    AUDIT_REJECT(10, "AUDIT_REJECT","Completed", "Completed", "URL/orderdetail"),//拒绝
    WAIT_WITHDRAW(11, "WAIT_WITHDRAW","Waiting for withdrawal", "Waiting for withdrawal", "URL/orderdetail"),
    MANUAL_CLOSED(12, "MANUAL_CLOSED","Completed", "Completed", "URL/orderdetail");

    private Integer code;
    private String name;
    private String desc;
    private String tips;
    private String url;

    OpenOrderStatusEnum(Integer code, String name, String desc, String tips, String url) {
        this.code = code;
        this.name = name;
        this.desc = desc;
        this.tips = tips;
        this.url = url;
    }

    public Integer getCode() {
        return code;
    }

    public OpenOrderStatusEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getName() {
        return name;
    }

    public OpenOrderStatusEnum setName(String name) {
        this.name = name;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public OpenOrderStatusEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public String getTips() {
        return tips;
    }

    public OpenOrderStatusEnum setTips(String tips) {
        this.tips = tips;
        return this;
    }

    public String getUrl() {
        return url;
    }

    public OpenOrderStatusEnum setUrl(String url) {
        this.url = url;
        return this;
    }

    public static OpenOrderStatusEnum getByCode(Integer code){
        OpenOrderStatusEnum openOrderStatusEnum;
        for(OpenOrderStatusEnum orderStatusEnum : OpenOrderStatusEnum.values()){
            if(orderStatusEnum.getCode().equals(code)){
                openOrderStatusEnum = orderStatusEnum;
                return openOrderStatusEnum;
            }
        }
        return null;
    }
}
